{include file="public/base" /}
{block name="main"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>订单详情</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <form method="get" action="javascript:;" class="form-horizontal">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">订单id</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" value="{$orderInfo['id']}" disabled>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">订单编号</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" value="{$orderInfo['order_number']}" disabled>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">商品</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" value="{$orderInfo['name']}" disabled>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">购买数量</label>

                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="num" value="{$orderInfo['number']}" disabled>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">下单时间</label>

                            <div class="col-sm-10">
                                <input type="text" disabled class="form-control" value="{$orderInfo['createtime']|date="Y-m-d H:i:s",###}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                      	<div class="form-group">
                            <label class="col-sm-2 control-label">发货时间</label>

                            <div class="col-sm-10">
                              {if $orderInfo['deliver_time']!=''}
                                <input type="text" disabled class="form-control" value="{$orderInfo['deliver_time']|date="Y-m-d H:i:s",###}">
                              {else}
                              <input type="text" disabled class="form-control" value="暂未发货">
                              {/if}
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">实付金额</label>

                            <div class="col-sm-10">
                                <input type="text" disabled="" placeholder="已被禁用" class="form-control" value="{$orderInfo['price']}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">购买用户</label>
                            <div class="col-sm-10">
                                <input type="text" disabled class="form-control" value="{$orderInfo['nickname']}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">收货地址</label>
                            <div class="col-sm-10">
                                <input type="text" disabled class="form-control" name="area" value="{$orderInfo['area']}{$orderInfo['address']}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">订单状态</label>
                            <div class="col-sm-10">
                                <select name="state" class="form-control">
                                    <option value="0">待支付</option>
                                    <option value="1">已支付</option>
                                    <option value="2">已发货</option>
                                    <option value="3">已完成</option>
                                    <option value="4">等待申诉</option>
                                  	<option value="5">申诉成功</option>
                                  	<option value="6">申诉驳回</option>
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <input type="hidden" name="id" value="{$orderInfo['id']}">
                                <button class="btn btn-primary" type="submit" onclick="edit()">保存内容</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="javascript"}
<script src="ADMIN_JS/content.min.js?v=1.0.0"></script>
<script src="ADMIN_JS/plugins/iCheck/icheck.min.js"></script>
<script>
    window.onload=function(){
        $("[name='state'] [value='{$orderInfo[\"status\"]}']").attr('selected',true);
    }
    function edit()
    {
        var loading = layer.msg('正在提交数据，请稍后...', {icon: 16,time:6000});
        var state = $("[name='state']").val();
        //var area = $("[name='area']").val();
        $.ajax({
            type:'post',
            url:'{:url("TaobaoOrder/orderEdit",["oid"=>$orderInfo["id"]])}',
            data:{'status':state},
            success:function(data){
                layer.close(loading);
                if(data.code==1){
                    layer.msg(data.msg,{icon:6,time:1500});
                    setTimeout(function(){window.parent.location.reload();},1000);
                }else{
                    layer.msg(data.msg,{icon:5,time:1500});
                }
            }
        })
    }

</script>
{/block}